//
//  TMConst.m
//  复合发行4.0
//
//  Created by liubowen on 2017/8/30.
//  Copyright © 2017年 Beijing TMYK Technology co.,ltd. All rights reserved.
//


/* 导航栏 最大Y值*/

CGFloat const TMMaxNavY = 64;


/* uitabbar 高度*/
CGFloat const TMTabBarH = 49;


/* 分类栏 高度*/
CGFloat const TMWMBarH = 32;

NSString *const FindPlaceholderImageName = @"图书";
//期刊
NSString *const TMmagazineDownloadProgressNotification = @"TMmagazineDownloadProgressNotification";
NSString *const TMmagazineDownloadSuccessNotification = @"TMmagazineDownloadSuccessNotification";
NSString *const TMmagazineZanClickSuccessNotification = @"TMmagazineZanClickSuccessNotification";
NSString *const TMmagazineZanClickSuccessnotloginNotification = @"TMmagazineZanClickSuccessnotloginNotification";
NSString *const TMmagazineZanClickfinishSuccessNotification = @"TMmagazineZanClickfinishSuccessNotification";
NSString *const TMMagazineDeleteSuccessNotification = @"TMMagazineDeleteSuccessNotification";
NSString *const TMMagazineClassChangedNotification = @"TMMagazineClassChangedNotification";

//报纸
NSString *const TMDownloadDeleteSuccessNotification = @"TMDownloadDeleteSuccessNotification";
NSString *const TMNewspaperDownloadSuccessNotification = @"TMNewspaperDownloadSuccessNotification";
NSString *const TMnewspaperHotPointsDidClickNotification = @"TMnewspaperHotPointsDidClickNotification";


// 听书
NSString *const TMListenInsertBookrackSuccessNotification = @"TMListenInsertBookrackSuccessNotification";

#pragma mark---文章正文页
NSString *const TMArticleContentWebViewHeight =  @"TMArticleContentWebViewHeight";
/* 评论提交成功*/
NSString *const TMCommentsendSuccess = @"TMCommentsendSuccess";

/* 设置字体字号的变大变小*/
NSString *const TMArticleFontSizeIncreaseOrReductionNotification = @"TMArticleFontSizeIncreaseOrReductionNotification";
/* 文章字号*/
NSString *const TMArticleFontSize =@"TMArticleFontSize";

/* 设置正文背景色*/
NSString *const TMArticleBGColorChangeNotification = @"TMArticleBGColorChangeNotification";
/* 文章背景色*/
NSString *const TMArticleBGColor =@"TMArticleBGColor";


/* 设置正文缩进方式*/
NSString *const TMArticleIndentChangeNotification = @"TMArticleIndentChangeNotification";
/* 文章缩进*/
NSString *const TMArticleIndent =@"TMArticleIndent";
/* 文章评论删除*/
NSString *const TMArticleCommentDeleteSuccessNotification = @"TMArticleCommentDeleteSuccessNotification";
/* 文章收藏和删除收藏操作*/
NSString *const TMArticleCollectionoperationNotification = @"TMArticleCollectionoperationNotification";


/*************** Listen ***************/

NSString * _Nonnull const TMListenDownloadInterruptionNotification = @"TMListenDownloadInterruptionNotification";

/*************** Listen ***************/

//消息中心
NSString *const TMMessageDeleteSuccessNotification = @"TMMessageDeleteSuccessNotification";
NSString *const TMMessageDidallDelegateSuccessNotification = @"TMMessageDidallDelegateSuccessNotification";
NSString *const TMUpdateSelectTitleIndexNotification = @"TMUpdateSelectTitleIndexNotification";

NSString *const TMUserManagerDidLoginNotification = @"TMUserManagerDidLoginNotification";
NSString *const TMUserManagerRegisterSuccessNotification = @"TMUserManagerRegisterSuccessNotification";
NSString *const TMUserManagerSendSMSCodeNotification = @"TMUserManagerSendSMSCodeNotification";
NSString *const TMUserManagerSendSMSCodeErrorNotification = @"TMUserManagerSendSMSCodeErrorNotification";
NSString *const TMUserManageriIdentitySendSMSCodeNotification = @"TMUserManageriIdentitySendSMSCodeNotification";
NSString *const TMUserManagerIdentitySendSMSCodeErrorNotification = @"TMUserManagerIdentitySendSMSCodeErrorNotification";

NSString *const TMUserManagerFailedLoginNotification = @"TMUserManagerFailedLoginNotification";
NSString *const TMUserManagerDidLogoutNotification = @"TMUserManagerDidLogoutNotification";
NSString *const TMUserManagerChangePasswordNotification = @"TMUserManagerChangePasswordNotification";
NSString *const TMUserManagerCancleChangePawNotification = @"TMUserManagerCancleChangePawNotification";
NSString *const TMUserManagerSaveChangePawNotification = @"TMUserManagerSaveChangePawNotification";
NSString *const TMUserManagerActiveReadCardNotification = @"TMUserManagerActiveReadCardNotification";
NSString *const TMUserManagerActiveReadCardFailNotification = @"TMUserManagerActiveReadCardFailNotification";

NSString *const TMHistoryDeleteSuccessNotification = @"TMHistoryDeleteSuccessNotification";
NSString *const TMUserHistortItemDidClickNotification = @"TMUserHistortItemDidClickNotification";
NSString *const TMUserManagerRetrievePasswordSuccessNotification = @"TMUserManagerRetrievePasswordSuccessNotification";
NSString *const TMUserManagerFeedBackSuccessNotification = @"TMUserManagerFeedBackSuccessNotification";
NSString *const TMUserManagerCheckPhoneNumRegisterNotification = @"TMUserManagerCheckPhoneNumRegisterNotification";


NSString *const TMVersionManagerGetVersionReviewStateNotification = @"TMVersionManagerGetVersionReviewStateNotification";
NSString *const TMNewsListrefreshDataNotification = @"TMNewsListrefreshDataNotification";
NSString *const TMowniconLoadSuccessNotification = @"TMowniconLoadSuccessNotification";
NSString *const TMnicknameLoadSuccessNotification = @"TMnicknameLoadSuccessNotification";



NSString *const TMReadMainTableViewDidScrollNotification = @"TMReadMainTableViewDidScrollNotification";



// ---------------- 发现 ----------------
NSString *const TMIntegralMallMAinCollectionCellDidClick = @"TMIntegralMallMAinCollectionCellDidClick";
NSString *const TMIntegralMallMAllGoodsCellDidClick = @"TMIntegralMallMAllGoodsCellDidClick";
NSString *const TMIntegralMallMAllGoodsSubmitStateSuccessNotification = @"TMIntegralMallMAllGoodsSubmitStateSuccessNotification";


// ---------------- 字符串高度 -> BEGIN ----------------

// 跟屏幕大小设置字体大小
float sizeForScreen(float width)
{
    if (width < 350) {
        return 16;
    } else if (width > 400) {
        return 18;
    } else {
        return 17;
    }
}
float fontSizeForDevice(void) {
    CGFloat H = [UIScreen mainScreen].bounds.size.height;
    
    if (fabs((double)(H - 480)) < DBL_EPSILON) {
        return 15;
    } else if (fabs((double)(H - 568)) < DBL_EPSILON) {
        return 16;
    } else if (fabs((double)(H - 667)) < DBL_EPSILON) {
        return 17;
    } else if (fabs((double)(H - 960)) < DBL_EPSILON) {
        return 18;
    } else if (fabs((double)(H - 568)) < DBL_EPSILON) {
        return 19;
    } else {
        return 20;
    }
}

// 获得字符串的高度
float heightForString(NSString *value, float fontSize, float width)
{
    if (!value.length) { return 0; }
    UIFont *font = [UIFont fontWithName:@"Helvetica" size:fontSize];
    //value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    CGRect sizeToFit = [value boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)
                                           options:NSStringDrawingUsesLineFragmentOrigin
                                        attributes:@{NSFontAttributeName: font}
                                           context:nil];
    return sizeToFit.size.height;
}
// 获取字符串的宽度
float widthForString(NSString *value, float fontSize, float height)
{
    if (!value.length) { return 0; }
    UIFont *font = [UIFont fontWithName:@"Helvetica" size:fontSize];
    CGRect sizeToFit = [value boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, height)
                                           options:NSStringDrawingUsesLineFragmentOrigin
                                        attributes:@{NSFontAttributeName: font}
                                           context:nil];
    return sizeToFit.size.width;
}

// ---------------- 字符串高度 -> END ----------------






